package com.redoor.app.stake.basicdata.hsf.service.impl;

import com.alibaba.boot.hsf.annotation.HSFProvider;
import com.redoor.app.stake.basicdata.dao.BaseStakeMapper;
import com.redoor.app.stake.basicdata.model.BaseStake;
import com.yotouch.app.stake.Consts;
import com.yotouch.app.stake.StakeConsts;
import com.yotouch.app.stake.hsf.kd.KdCountStakeService;
import com.yotouch.app.stake.model.CountStake;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * I6000统计指标接口实现类
 * Created by zhanggYiHang on 2018/3/29.
 */
@HSFProvider(serviceInterface = KdCountStakeService.class, serviceVersion = "5.0.0", serviceGroup = "grp_asset_of_stake", clientTimeout = 600000)
@Service
public class KdCountStakeServiceImpl implements KdCountStakeService {

    @Autowired
    private BaseStakeMapper baseStakeMapper;

    @Override
    public CountStake countStakeData() {
        CountStake countStake = new CountStake();
        BaseStake baseStake = new BaseStake();
        baseStake.setStatus(Consts.STATUS_NORMAL);
        int count = this.baseStakeMapper.selectCount(baseStake);
        baseStake.setStakestatus(3);
        int onLineCount = this.baseStakeMapper.selectCount(baseStake);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("status", Consts.STATUS_NORMAL);
        map.put("types", 1);
        int selfCount = this.baseStakeMapper.selectCountBySelf(map);
        map.put("types", 2);
        int societyCount = this.baseStakeMapper.selectCountBySelf(map);

        countStake.setCount(count);
        countStake.setSelfCount(selfCount);
        countStake.setSocietyCount(societyCount);
        countStake.setOnLineCount(onLineCount);
        return countStake;
    }
}
